﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
using CampusMarket.Model;

namespace CampusMarket
{
    /// <summary>
    /// WindowShelf.xaml 的交互逻辑
    /// </summary>
    public partial class WindowShelf : Window
    {
        ObservableCollection<Goods> itemList = new ObservableCollection<Goods>();
        public WindowShelf()
        {
            this.DataContext = itemList;
            Goods testItem = new Goods();
            testItem.Goods_Name = "测试商品名称";
            testItem.Goods_CreateTime = new DateTime(2016, 1, 5);
            testItem.Goods_OriginPrice = 20.0;
            itemList.Add(testItem);
            InitializeComponent();
        }

        private void RevokeButton_Click(object sender, RoutedEventArgs e)
        {

        }

        private void ModifyButton_Click(object sender, RoutedEventArgs e)
        {
            var btn = sender as Button;
            var item = btn.DataContext as Goods;
            WindowPostItem wid = new WindowPostItem(item);
            wid.Owner = WindowShelf.GetWindow(this);
            wid.Show();
        }
    }
}
